<%-- 
    Document   : Stock Barang
    Created on : 26 Nov 13, 19:01:17
    Author     : PUTIK ALWENA
--%>

<%@page import="java.util.Set"%>
<%@page import="Model.Pesanan"%>
<%@page import="java.util.List"%>
<%@page import="java.util.logging.Logger"%>
<%@page import="java.util.logging.Level"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.Statement"%>
<%@page import="Model.DatabaseConnect"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Halaman Pesanan</title>
    </head>
    <body background="background.jpg">
        <form action="PesananBarangControl.jsp" method="post" name="pesanan">
            <table width="1009" border="0">
              <tr>
                <td width="406" height="28" align="center" valign="middle"><h2><a href="PesananBarang.jsp">Daftar Pesanan</a></h2></td>
                <td width="286" align="center" valign="middle"><h2><a href="StokBarang.jsp">Stock Barang</a></h2></td>
                <td width="295" align="center" valign="middle"><h2><a href="PesanBarang.jsp">Pesan Barang</a></h2></td>
                <td width="295" align="center" valign="middle"><h2><a href="KirimBarang.jsp">Pengiriman Barang</a></h2></td>
                <td width="295" align="center" valign="middle"><h2><a href="TerimaBarang.jsp">Terima Barang</a></h2></td> 
                <td width="295" align="center" valign="middle"><h2> <a href="Login.jsp">Logout</a></h2></td>
            </tr>
                <td width="200" valign="top"><h2>Daftar Pesanan </h2> 
                    <select name="kodetoko" style="background-color: aquamarine">
                        <option value="none">Pilih Kantor Cabang</option>
                        <option value="ck02">Toko A</option>
                        <option value="ck03">Toko B</option>
                        <option value="ck04">Toko C</option>
                    </select>
                </td>
                <tr>
                    <td><input type="submit" value="Lihat" /></td>
                </tr>
                <%  Model.Pesanan cekpesanan = (Model.Pesanan) session.getAttribute("pesanan");
                    if (cekpesanan == null) {
                        cekpesanan = new Pesanan();
                        session.setAttribute("pesanan", cekpesanan);
                    }
                    Model.Pesanan daftarpesanan = new Pesanan();
                    String kodetoko = request.getParameter("kodetoko");
                    if (kodetoko.matches("ck01")) {
                        List<Pesanan> Listdaftar = daftarpesanan.tampilpesanan(kodetoko);
                %>

                <tr>
                <table align="center" width="800" height="75" border="0">
                    <b><a>Tabel Pesanan</a></b>
                    <th bgcolor="#999999" width="100"><div align="center">Kode Barang</div> </th>
                    <th bgcolor="#999999" width="250"><div align="center">Nama Barang</div> </th>
                    <th bgcolor="#999999" width="200"><div align="center">Jenis Barang</div></th>
                    <th bgcolor="#999999" width="250"><div align="center">Harga </div></th>
                    <th bgcolor="#999999" width="100"><div align="center">Jumlah</div></th>
                    <th bgcolor="#999999" width="200"><div align="center">Tanggal Pesanan</div> </th>
                    <tr>
                        <%
                            for (Pesanan list : Listdaftar) {
                        %>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getKodeBarang()%></div></td>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getNamaBarang()%></div></td>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getJenisBarang()%></div></td>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getHargaBarang()%></div></td>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getJumlahBarang()%></div></td>
                        <td bgcolor="#FFFFFF"><div align="center"><%=list.getTgl_pesanan()%></div></td>
                    </tr>
                    <%
                        }
                    } else if (kodetoko.matches("ck02")) {
                        List<Pesanan> Listdaftara = daftarpesanan.tampilpesanan(kodetoko);
                    %>
                    <tr>
                    <table align="center" width="800" height="75" border="0">

                        <th bgcolor="#999999" width="150"><div align="center">Kode Barang</div> </th>
                        <th bgcolor="#999999" width="350"><div align="center">Nama Barang</div> </th>
                        <th bgcolor="#999999" width="200"><div align="center">Jenis Barang</div></th>
                        <th bgcolor="#999999" width="250"><div align="center">Harga </div></th>
                        <th bgcolor="#999999" width="150"><div align="center">Jumlah</div></th>
                        <th bgcolor="#999999" width="200"><div align="center">Tanggal Pesanan</div> </th>
                        <tr>
                            <%
                                for (Pesanan lista : Listdaftara) {
                            %>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getKodeBarang()%></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getNamaBarang()%></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getJenisBarang()%></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getHargaBarang()%></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getJumlahBarang()%></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><%=lista.getTgl_pesanan()%></div></td>
                        </tr>
                        <%}
                        } else if (kodetoko.matches("ck03")) {
                            List<Pesanan> Listdaftarb = daftarpesanan.tampilpesanan(kodetoko);
                        %>
                        <tr>
                        <table align="center" width="800" height="75" border="0">

                            <th bgcolor="#999999" width="150"><div align="center">Kode Barang</div> </th>
                            <th bgcolor="#999999" width="350"><div align="center">Nama Barang</div> </th>
                            <th bgcolor="#999999" width="200"><div align="center">Jenis Barang</div></th>
                            <th bgcolor="#999999" width="250"><div align="center">Harga </div></th>
                            <th bgcolor="#999999" width="150"><div align="center">Jumlah</div></th>
                            <th bgcolor="#999999" width="200"><div align="center">Tanggal Pesanan</div> </th>
                            <tr>
                                <%
                                    for (Pesanan listb : Listdaftarb) {
                                %>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getKodeBarang()%></div></td>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getNamaBarang()%></div></td>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getJenisBarang()%></div></td>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getHargaBarang()%></div></td>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getJumlahBarang()%></div></td>
                                <td bgcolor="#FFFFFF"><div align="center"><%=listb.getTgl_pesanan()%></div></td>
                            </tr>
                            <%}
                            } else if (kodetoko.matches("ck04")) {
                                List<Pesanan> Listdaftarc = daftarpesanan.tampilpesanan(kodetoko);
                            %>
                            <tr>
                            <table align="center" width="800" height="75" border="0">

                                <th bgcolor="#999999" width="150"><div align="center">Kode Barang</div> </th>
                                <th bgcolor="#999999" width="350"><div align="center">Nama Barang</div> </th>
                                <th bgcolor="#999999" width="200"><div align="center">Jenis Barang</div></th>
                                <th bgcolor="#999999" width="250"><div align="center">Harga </div></th>
                                <th bgcolor="#999999" width="150"><div align="center">Jumlah</div></th>
                                <th bgcolor="#999999" width="200"><div align="center">Tanggal Pesanan</div> </th>
                                <tr>
                                    <%
                                        for (Pesanan listc : Listdaftarc) {
                                    %>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getKodeBarang()%></div></td>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getNamaBarang()%></div></td>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getJenisBarang()%></div></td>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getHargaBarang()%></div></td>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getJumlahBarang()%></div></td>
                                    <td bgcolor="#FFFFFF"><div align="center"><%=listc.getTgl_pesanan()%></div></td>
                                </tr>
                                <%
                                        }
                                    }
                                %>


                            </table>
                            </form>
                            </body>
                            </html>
